package bstsetcode.test;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/15 11:07
 *
 * 数据长度为0和数组为null不是同一个概念；
 * 长度为0，数组对象是存在的；
 * 数组为null,没有长度，会报异常
 */
public class Main {

    public static void main(String[] args) {
        int[] arr = new int[0];
        int[] a= null;

        if(arr.length == 0)
            System.out.println("arr.length == 0");
        else {
            System.out.println("arr.length != 0");
        }

        if(arr == null)
            System.out.println("arr == null");
        else {
            System.out.println("arr != null");
        }
        if(a == null){
            System.out.println("a == null");
        }else{
            System.out.println("a != null");
        }


        if(a.length == 0){
            System.out.println("a.length ==0");
        }else{
            System.out.println("a.lenght !=0");
        }
    }
}
